Method for restoring video data of pipe based on computer vision

ABSTRACT

A method for restoring video data of a pipe based on computer vision is provided. The method includes: performing gray stretching on pipe image/video collected by a pipe robot; processing noise interference by smoothing filtering; extracting an iron chain from the center of a video image as a template for location; performing target recognition on the center of video data by an SIFT corner detection algorithm; detecting ropes on left and right sides of a target by Hough transform; performing gray covering on the iron chain at the center of the video image and the ropes on two sides; and restoring data by an FMM image restoration algorithm.

CROSS REFERENCE TO RELATED APPLICATION

This patent application claims the benefit and priority of ChinesePatent Application No. 202110268931.X, entitled “method for restoringvideo data of drainage pipe based on computer vision” filed with theChina National Intellectual Property Administration on Mar. 12, 2021,the disclosure of which is incorporated by reference herein in itsentirety as part of the present application.

TECHNICAL FIELD

The present disclosure relates to the technical field of image and videoprocessing, and in particular, to an image restoration technique basedon computer vision, including target detection and straight linedetection.

BACKGROUND ART

Detection and repair of pipe defects would be an important part of urbanconstruction, which has become a research hotspot in computer vision.Unfortunately, it is very difficult to obtain high-quality video data ofa pipe. At present, pipe detection mainly relies on a pipe robotequipped with a high-definition camera to obtain internal data of apipe. The mainstream pipe robots on the market are generally pulled byropes to go forward, and therefore, the ropes will inevitably appear inthe video data of pipes. The ropes will seriously interfere with theidentification of defects in edge information of a pipe. In view of theabove-mentioned problem in the video data of the pipe, the presentdisclosure focuses on the research of a video data restoration algorithmbased on computer vision, in which scale invariant feature transform(SIFT) corner detection is used to recognize a target and Houghtransform is used to detect the ropes, and image restoration isperformed on the recognized area. This method can effectively eliminatethe interference of ropes and an iron chain in the video data of thepipe.

At present, there are some problems in the field of pipe defectrecognition, such as interference from a power unit of a robot in videodata of a pipe. As a result, in an actual complex pipe environment,defect features of the pipe are easily affected by a change of the powerunit, and subsequent pipe detection cannot be performed efficiently,thereby increasing detection costs.

The present disclosure provides a method for restoring video data of apipe based on computer vision, which is applicable to the field of pipedefect detection and repair.

SUMMARY

In view of the above-mentioned problems in the conventional art, bycombining an SIFT corner detection algorithm, a Hough transform straightline detection algorithm, and Telea's fast marching method (FMM) imagerestoration algorithm in the current computer vision field, the presentdisclosure provides a method for restoring video data of a pipe based oncomputer vision. This method can effectively eliminate an interferenceof a rope power source in the video data of a pipe, thereby improvingthe quality of the data and significantly enhancing the efficiency ofpipe corrosion detection, and the method is applicable to the field ofurban drainage pipe maintenance.

To achieve the above effect, the present disclosure provides thefollowing technical solution:

Step (1), a pipe robot is controlled to obtain pipe images/videos in apipe, and gray stretching and smoothing filtering are performed on thepipe images/videos.

Step (2), a clear frame of data is selected to extract an iron chainfrom the data as a template.

Step (3), target detection is performed on the iron chain in the centerof the pipe in the video data by using an SIFT algorithm to determine aposition of the iron chain.

Step (4), ropes on left and right sides of the iron chain are detectedby using Hough transform to determine positions of the ropes.

Step (5), pixels with a gray value of 0 are used to cover the locatediron chain and ropes.

Step (6), the video data is restored by using Telea's FMM imagerestoration algorithm.

Step (7), the restored video data is obtained.

The present disclosure has the following advantages: the method caneffectively eliminate the interference of the iron chain and ropes inthe video data of a pipe, thereby improving efficiency of subsequentpipe defect recognition, and thus having a certain reference value forpipe defect detection.

BRIEF DESCRIPTION OF THE DRAWINGS

The present disclosure will be further described below in conjunctionwith the accompanying drawings and embodiments.

FIG. 1 is a flow chart according to the present disclosure.

FIG. 2 shows an image showing gray stretching and smoothing filteringaccording to the present disclosure.

FIG. 3 shows an image of an iron chain extracted from video dataaccording to the present disclosure.

FIG. 4 shows a view of target detection by using an SIFT algorithmaccording to the present disclosure.

FIG. 5 shows an effect image of ropes detected by using Hough transformaccording to the present disclosure.

FIG. 6 shows an effect image with an iron chain and ropes coveredaccording to the present disclosure.

FIG. 7 shows a basic principle of an FMM algorithm according to thepresent disclosure.

FIG. 8 shows effect images of restored data according to the presentdisclosure.

DETAILED DESCRIPTION OF THE EMBODIMENTS

To make the objective, technical solutions and effects of the presentdisclosure clearer and more comprehensible, the present disclosure willbe described in more detail with reference to the accompanying drawingsand embodiments, but these embodiments should not be construed as alimitation to the present disclosure.

As shown in FIG. 1 , a method for restoring video data of a pipe basedon computer vision provided in the present disclosure is specificallyimplemented by the following steps:

S1010: a pipe robot with a high-definition camera enters a pipe tocollect image/video information of a pipe, and gray stretching isperformed on the collected pipe image/video. Contrast of the pipe imageis enhanced to make light and shade contrast of the pipe image moredistinct and features more obvious. A gray value ƒ(x,y) of each pixel(x,y) in an input image is used as an independent variable of afunction, and H denotes a transform operation performed on ƒ(x,y) in thespatial domain to increase or reduce the gray value thereof, and thus adependent variable is obtained as a gray value g(x,y) in an outputimage. Equation (1) is specifically as follows:g(x,y)=H[ƒ(x,y)]  (1)

Spatial smoothing filtering enhancement is performed on a gray image byusing an adjacent averaging method of a spatial domain method, therebyeliminating jagged contours due to uneven light, local highlighting, andmetal reflection caused by a point light source in a real pipeenvironment. The weight of each pixel is equal in the adjacent averagingmethod, that is, importance of each pixel is assumed to be the same, andequation (2) is specifically as follows:

$\begin{matrix}{{g\left( {x,y} \right)} = {\frac{1}{M}{\sum\limits_{i,{j \in s}}{f\left( {i,j} \right)}}}} & (2)\end{matrix}$

where s is a set of pixel coordinates in a neighborhood of (x,y), while(i,j) is coordinates of a pixel in the neighborhood and M is the numberof pixels in the set s. A resulting preprocessed image is as shown inFIG. 2 .

S1110: an iron chain is extracted from a center of video data as atemplate for target recognition. An image of the iron chain isintercepted in the center of the video data image after the image ispreprocessed, as shown in FIG. 3 .

S1120: target detection is performed on all data by using an SIFT cornerdetection algorithm, and the iron chain at the center is found andlocated.

SIFT is short for scale-invariant feature transform, which is adescription used in the field of image processing. This description isscale-invariant, which allows detection of key points in an image, andis a local feature descriptor. The SIFT has good stability andinvariance, and is adaptable to rotation, scaling, and variablebrightness, and capable of avoiding interference of variable viewingangle, affine transformation and noise to a certain extent.

The SIFT algorithm uses a Gaussian kernel function to perform filteringwhen constructing a scale space, so that an original image preserves themost detail features, and the detail features are gradually reducedafter Gaussian filtering to simulate feature representation in a largescale situation. L(x,y,σ) is defined as a convolution operation of theoriginal image I(x,y) and a scale-variable two-dimensional Gaussianfunction G(x,y,σ).

$\begin{matrix}{{G\left( {x,y,\sigma} \right)} = {\frac{1}{2\pi\sigma^{2}}{\exp\left( {- \frac{\left( {x - {m/2}} \right)^{2} + \left( {y - {n/2}} \right)^{2}}{2\sigma^{2}}} \right)}}} & (3)\end{matrix}$ $\begin{matrix}{{L\left( {x,y,\sigma} \right)} = {{G\left( {x,y,\sigma} \right)}*{I\left( {x,y} \right)}}} & (4)\end{matrix}$

As shown in equations (3) and (4), (x,y) represents a pixel position inthe image, and m, n represent a center of a Gaussian template; σrepresents a scale space factor, and the smaller the value of the scalespace factor, the less the image is smoothed, and the smaller thecorresponding scale; a large scale corresponds to overview features ofthe image, while a small scale corresponds to detail features of theimage; and * represents the convolution operation.

Extreme points are found out based on scale invariance, and a referencedirection needs to be assigned to each key point based on local featuresof the image, so that the descriptor is invariant to rotation of theimage. For key points detected in a difference of Gaussian (DOG)pyramid, gradient and direction distribution features of pixels in anadjacent window of a layer of Gaussian pyramid image to which such keypoints correspond are collected. A module value m(x,y) and a directionθ(x,y) of the gradient are as shown in equations (5) and (6):

$\begin{matrix}{{m\left( {x,y} \right)} = \sqrt{\begin{matrix}{\left. {\left( {{L\left( {x + 1} \right)},y} \right) - {L\left( {{x - 1},y} \right)}} \right)^{2} +} \\\left( {{L\left( {x,{y + 1}} \right)} - {L\left( {x,{y - 1}} \right)}} \right)^{2}\end{matrix}}} & (5)\end{matrix}$ $\begin{matrix}{{\theta\left( {x,y} \right)} = {\tan^{- 1}\left( \left( {{L\left( {x,{y + 1}} \right)} - {{L\left( {x,{y - 1}} \right)}/\left( {{L\left( {{x + 1},y} \right)} - {L\left( {{x - 1},y} \right)}} \right)}} \right) \right.}} & (6)\end{matrix}$

This algorithm uses a gradient histogram statistical method to countimage pixels in a particular area with a key point as an origin todetermine a direction of the key point. After completing the gradientcalculation of the key points, a histogram is used to show the gradientsand directions of pixels in the neighborhood. A peak direction of thehistogram represents a main direction of the key points, while a peak ofa direction histogram represents a direction of a neighborhood gradientat this feature point and a maximum value in the histogram is taken asthe main direction of the key points. To enhance robustness of matching,only directions in which peaks are greater than 80% of the peak of themain direction are kept as auxiliary directions of the key points.

The SIFT corner detection is used to perform target detection on thedata, with an effect view of target detection as shown in FIG. 4 .

S1130: positions of ropes are detected by using Hough transform after aposition of the center of the data is obtained. A main principle is asfollows: all straight lines ƒ(x)=kx+b (k representing a straight slopeand b representing y-intercept) that possibly pass through each pixelpoint (x₀,y₀) at an edge are mapped into a Hough space, and thenappropriate positions are selected. As a straight line perpendicular tox-axis does not have the slope, it cannot be expressed based on theslope, and thus is expressed by a parametric equationr=x*cos(θ)+y*sin(θ), where (x,y) represents a pixel point at an edge,while r represents a distance between a straight line passing throughthis point and the origin, and θ represents an included angle between rand the positive x-axis. Voting is performed in the Hough space aftermapping of each edge point, and 1 is added to a pixel value of the edgepoint (x,y) every time a straight line equation satisfies this point(r,θ).

After the ropes are detected by using the Hough transform, the resultingimage is as shown in FIG. 5 .

S1140: the positions of the central iron chain and the ropes on twosides are obtained after the above two steps. The positions of the ironchain and the ropes are then covered with pixels having a gray value of0, thereby getting ready for restoration. A resulting image is as shownin FIG. 6 .

S1150: the data is restored by Telea's FMM (fast marching method) imagerestoration algorithm.

The fast marching restoration algorithm is a fast time-sensitive imagerestoration method. The basic idea of this algorithm is to startrestoration from the edge pixels of an area to be restored, graduallymarch to the pixels within the area to be restored and finally completethe whole restoration process. Several parameters are defined first: Ωis defined as the area to be restored of the image, and ∂Ω is defined asa boundary where the area to be restored is in contact with an undamagedarea. The nature of fast marching is to obtain distances T between allpixel points in the area Ω and the boundary ∂Ω, wherein the distancesare positive values when pixel points are in the area to be restored,and the distances are negative values when pixel points are outside thearea to be restored; a sequence of marching is determined according tothe magnitude of T, and restoration is continued until all pixels withinΩ are processed. The basic principle of the FMM algorithm is as shown inFIG. 7 .

For a damaged point p in ∂Ω, an area B_(ε)(p) with width ε on an outsideof the boundary is created, and a gray value of pixel point p in thisarea is calculated based on the gray values of all known pixel points qaccording to the following equation:R _(q)(p)=R(q)+∇R(q)(p−q)  (7)

where R(q) and ∇R(q) represent the gray value and the gradient value ofthe known pixel point q, respectively; and obviously, the gray value ofpoint p needs to be calculated through substitutions of parameters ofall undamaged points in the area B_(F)(p). These undamaged pixel pointsin the area have different weights in the whole operation process, andthe respective weights are obtained by using a weighting calculationequation (8):

$\begin{matrix}{{R(p)} = \frac{\sum_{q \in {B_{l}(p)}}{{w\left( {p,q} \right)}\left\lbrack {{R(q)} + {{\nabla{R(q)}}\left( {p - q} \right)}} \right\rbrack}}{\sum_{q \in {B_{l}(p)}}{w\left( {p,q} \right)}}} & (8)\end{matrix}$

where w(p,q) represents a weight function for a pixel which is used todetermine a contribution of each pixel in the domain B_(F)(p). w(p,q)refers to an iso-illuminance parameter of the damaged point p and isrelated to a geometric distance parameter between two points. Thisprocessing approach retains an extension of regional image structuredata to a certain extent during updating and calculation of parametersof the damaged point p. The function is defined as equation (9):w(p,q)=dir(p,q)*dst(p,q)*lev(p,q)  (9)

where * represents the convolution operation, dir(p,q) represents atexture direction constraint, dst(p,q) represents a geometric distanceconstraint and lev(p,q) represents a level set constraint. dir(p,q)reflects correlation between point p and point q in the texturedirection, and the more approximate the two points in texture, thegreater the weight. dst(p,q) reflects correlation of a geometricdistance between point p and point q, and obviously, the smaller thisvalue, the greater the weight. lev(p,q) reflects an influence ofinformation arrival, and the weight is greater when it is closer toknown information.

The three constraint conditions are as shown in equations (10):

$\begin{matrix}{{{dir}\left( {p,q} \right)} = {\frac{p - q}{{p - q}} \cdot {N(p)}}} & (10)\end{matrix}$${{dst}\left( {p,q} \right)} = \frac{d_{0}^{2}}{{{p - q}}^{2}}$${{lev}\left( {p,q} \right)} = \frac{T_{0}}{1 + {❘{{T(p)} - {T(q)}}❘}}$

where d₀ and T₀, as a distance constraint parameter and a level setconstraint parameter, are generally set to 1. dir(p,q) ensures a greatercontribution of a known pixel point of N=∇T when closer to a normaldirection, and N(p) represents the texture direction of point p.dst(p,q) ensures a greater weight of a known point closer to damagedpoint p in gray updating and calculation thereof. lev(p,q) ensures agreater contribution of a known point closer to the boundary outside thesame boundary ∂Ω.

A direction of an iso-illuminance curve of the FMM algorithm is updatedaccording to a calculation of a domain T. To ensure that the restorationis started from an initial boundary ∂Ω and to eliminate interference ofa large number of irrelevant internal pixels far away from the boundary,a distance domain T needs to be calculated on two sides of the initialboundary ∂Ω. As described above, the gray value of pixel point p iscalculated based on the known pixels in the domain B_(ε)(p), and then, aset −T_(out) of points outside the boundary is calculated outside theboundary area ∂Ω within a restricted range of T≤ε, and similarly, a setT_(in) of internal points relative to the boundary is calculated insidethe boundary area ∂Ω, thereby defining the whole T domain andguaranteeing that the restoration calculation of FMM is performed on anarrow edge with a width of ε on an outside of the boundary ∂Ω. The Tdomain of the whole image is then defined as:

$\begin{matrix}{{T(p)} = \left\{ \begin{matrix}{{T_{in}(p)},{p \in \Omega}} \\{{- {T_{out}(p)}},{p \notin \Omega}}\end{matrix} \right.} & (11)\end{matrix}$

For the value of ε of the selected domain B_(ε)(p), 3-10 pixel pointsare usually selected for a good effect, thereby achieving balancebetween a restoration rate and a restoration effect.

After the image is restored by using the FMM algorithm, the resultingrestored image is as shown in FIG. 8 .

The specific embodiments described herein are merely intended toillustrate the spirit of the present disclosure by way of example. Aperson skilled in the art can make various modifications or supplementsto the specific embodiments described or replace them in a similarmanner, but it may not depart from the spirit of the present disclosureor the scope defined by the appended claims.

What is claimed is:
 1. A method for restoring video data of a pipe basedon computer vision, comprising: step (1): collecting image/videoinformation of a pipe by a pipe robot with a high-definition cameraentering the pipe, and performing gray stretching on the collected pipeimage/video; enhancing contrast of the pipe image to make light andshade contrast of the pipe image more distinct and features moreobvious; wherein a gray value ƒ(x,y) of each pixel (x,y) in an inputimage is as an independent variable of a function, H denotes a transformoperation performed on ƒ(x,y) in a spatial domain to increase or reducethe gray value, to obtain a dependent variable as a gray value g(x,y) inan output image, and equation (1) is as follows:g(x,y)=H[ƒ(x,y)]  (1) performing spatial smoothing filtering enhancementon a gray image by using an adjacent averaging method of a spatialdomain method, wherein weight of each pixel is equal in the adjacentaveraging method, considering that importance of each pixel is assumedto be same, and equation (2) is as follows: $\begin{matrix}{{g\left( {x,y} \right)} = {\frac{1}{M}{\sum\limits_{i,{j \in s}}{f\left( {i,j} \right)}}}} & (2)\end{matrix}$ wherein, s is a set of pixel coordinates in a neighborhoodof (x,y), (i,j) is coordinates of a pixel in the neighborhood and M is anumber of pixels in the set s; step (2): extracting an iron chain from acenter of data as a template for target recognition, and intercepting animage of the iron chain in a center of the video data image after imagepreprocessing; step (3): performing target detection on all data byusing a scale-invariant feature transform (SIFT) corner detectionalgorithm to locate the iron chain at the center; wherein, a Gaussiankernel function is used to perform filtering when constructing a scalespace; and L(x,y,σ) is defined as a convolution operation of theoriginal image I(x,y) and a scale-variable two-dimensional Gaussianfunction G(x,y,σ), and equations (3) and (4) are as follows:$\begin{matrix}{{G\left( {x,y,\sigma} \right)} = {\frac{1}{2\pi\sigma^{2}}{\exp\left( {- \frac{\left( {x - {m/2}} \right)^{2} + \left( {y - {n/2}} \right)^{2}}{2\sigma^{2}}} \right)}}} & (3)\end{matrix}$ $\begin{matrix}{{L\left( {x,y,\sigma} \right)} = {{G\left( {x,y,\sigma} \right)}*{I\left( {x,y} \right)}}} & (4)\end{matrix}$ wherein * represents the convolution operation, (x,y)represents a pixel position in an image; m, n represent a center of aGaussian template; and σ represents a scale space factor; for key pointsdetected in a difference of Gaussian (DOG) pyramid, gradient anddirection distribution features of pixels in an adjacent window of alayer of a Gaussian pyramid image to which the key points correspond,are collected, wherein, a module value m(x,y) and a direction θ(x,y) ofthe gradient are as shown in equations (5) and (6), a function L(x,y),with a same meaning as the equations (4), is defined as the convolutionoperation of a point (x,y) in the original image and the scale-variabletwo-dimensional Gaussian function, in the equations (5) and (6), σ isomitted as it is a fixed value and will not change arbitrarily, and theequations (5) and (6) are as follows: $\begin{matrix}{{m\left( {x,y} \right)} = \sqrt{\begin{matrix}{\left. {\left( {{L\left( {x + 1} \right)},y} \right) - {L\left( {{x - 1},y} \right)}} \right)^{2} +} \\\left( {{L\left( {x,{y + 1}} \right)} - {L\left( {x,{y - 1}} \right)}} \right)^{2}\end{matrix}}} & (5)\end{matrix}$ $\begin{matrix}{{\theta\left( {x,y} \right)} = {\tan^{- 1}\left( \left( {{L\left( {x,{y + 1}} \right)} - {{L\left( {x,{y - 1}} \right)}/\left( {{L\left( {{x + 1},y} \right)} - {L\left( {{x - 1},y} \right)}} \right)}} \right) \right.}} & (6)\end{matrix}$ wherein, a gradient histogram statistical method is usedto count image pixels in a particular area with a key point as theorigin to determine a direction of the key point; after completing thegradient calculation of the key points, a histogram is used to show thegradients and directions of pixels in the neighborhood, with a peakdirection of the histogram representing a main direction of the keypoints, a peak of a direction histogram representing a direction of aneighborhood gradient at this feature point and a maximum value in thehistogram being taken as the main direction of the key points; onlydirections in which peaks are greater than 80% of the peak of the maindirection are kept as auxiliary directions of the key points; and cornerdetection is used to perform target detection on the data; step (4):detecting positions of ropes by using Hough transform after a positionof the center of the data is obtained, wherein a main principle is asfollows: all straight lines ƒ(x)=kx+b that pass through each pixel point(x_(θ),y_(θ)) at an edge are mapped into a Hough space, and thenappropriate positions are selected, wherein, k represents a straightslope and b represents y-intercept; a straight line perpendicular tox-axis, which does not have the slope and cannot be expressed based onthe slope, is expressed by a parametric equation r=x*cos(θ)+y*sin(θ),wherein (x,y) represents a pixel point at an edge, r represents adistance between a straight line passing through this point and theorigin, and θ represents an included angle between r and positivex-axis; and voting in the Hough space after mapping of each edge point,and adding 1 to a pixel value of point (r,θ) every time a straight lineequation satisfies this point; step (5): covering positions of the ironchain and the ropes obtained through steps (3) and (4) with pixelshaving a gray value of 0; and step (6): restoring the data by usingTelea's fast marching method (FMM) image restoration algorithm, whereina fast marching restoration algorithm is a fast time-sensitive imagerestoration method, and is adopted to start restoration from edge pixelsof an area to be restored, march to pixels within the area to berestored and finally complete a restoration process; several parametersare defined first as follows: Ω is defined as the area to be restored ofthe image, and ∂Ω is defined as a boundary where the area to be restoredis in contact with an undamaged area; nature of fast marching is toobtain distances T between all pixel points in the area to be restored Ωand the boundary ∂Ω, wherein the distances are positive values whenpixel points are in the area to be restored, and the distances arenegative values when pixel points are outside the area to be restored; asequence of restoration is determined according to a magnitude of T, andthe restoration is continued until all pixels within Ω are processed;for a damaged point R in ∂Ω, an area B_(ε)(p) with a width of ε on twosides of the boundary is created, and a gray value of a pixel point p inthis area is calculated based on gray values of all known pixel points qaccording to the following equation:R _(q)(p)R(q)+∇R(q)(p−q)  (7) wherein R(q) represents the gray value ofthe known pixel point q and ∇R(q) represents a gradient value of theknown pixel point q; B_(ε)(p) these undamaged pixel points in the areahave different weights in the whole operation process, and therespective weights are obtained by using a weighting calculationequation (8): $\begin{matrix}{{R(p)} = \frac{\sum_{q \in {B_{l}(p)}}{{w\left( {p,q} \right)}\left\lbrack {{R(q)} + {{\nabla{R(q)}}\left( {p - q} \right)}} \right\rbrack}}{\sum_{q \in {B_{l}(p)}}{w\left( {p,q} \right)}}} & (8)\end{matrix}$ wherein w(p,q) represents a weight function for a pixelwhich is used to determine a contribution of each pixel in the domainB_(ε)(p); w(p,q) refers to an iso-illuminance parameter of the damagedpoint p and is related to a geometric distance parameter between twopoints; this processing method preserves continuous texture of the dataof a local area of the image to a certain extent during updating andcalculation of parameters of the damaged point p; and the function isdefined as equation (9):w(p,q)=dir(p,q)*dst(p,q)*lev(p,q)  (9) wherein * represents theconvolution operation, dir(p,q) represents a texture directionconstraint, dst(p,q) represents a geometric distance constraint andlev(p,q) represents a level set constraint; dir(p,q) reflectscorrelation between point p and point q in the texture direction;dst(p,q) reflects correlation of a geometric distance between point pand point q, and a smaller value means that the weight is greater; andlev(p,q) ensures that the known pixel point closer to the contour of anarea to be repaired at the point p contribute more to the point p; threeconstraint conditions are as shown in equations (10): $\begin{matrix}{{{dir}\left( {p,q} \right)} = {\frac{p - q}{{p - q}} \cdot {N(p)}}} & (10)\end{matrix}$${{dst}\left( {p,q} \right)} = \frac{d_{0}^{2}}{{{p - q}}^{2}}$${{lev}\left( {p,q} \right)} = \frac{T_{0}}{1 + {❘{{T(p)} - {T(q)}}❘}}$wherein d₀ and T₀, as a distance constraint parameter and a level setconstraint parameter respectively, are generally set to be 1; dir(p,q)N=∇T and N(p) represents the texture direction of point p; dst(p,q) plev(p,q) ∂Ω wherein, a direction of an iso-illuminance curve of the FMMalgorithm is updated according to a calculation of a domain T; ∂Ω adistance domain T on two sides of the initial boundary ∂Ω is calculated;the gray value of pixel point p as described above is calculated basedon the known pixels in the domain B_(ε)(p), and then a set −T_(out) ofpoints outside the boundary is calculated outside the boundary area ∂Ωwithin a range of T≤ε, and similarly, a set T_(in) of internal pointsrelative to the boundary is calculated inside the boundary area ∂Ω,thereby defining the whole T domain and guaranteeing that therestoration calculation of FMM is performed on a narrow edge with awidth of ε on two sides of the boundary ∂Ω; and the T domain of thewhole image is then defined as: $\begin{matrix}{{T(p)} = \left\{ \begin{matrix}{{T_{in}(p)},{p \in \Omega}} \\{{- {T_{out}(p)}},{p \notin \Omega}}\end{matrix} \right.} & (11)\end{matrix}$ for the value of ε of the selected domain B_(ε)(p), 3-10pixel points are selected for a good effect.